package com.service.xsxt;

import com.dao.xsxt.ThisRaceMapper;
import com.entity.common.ApiResult;
import com.entity.xsxt.ThisRace;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by System on 2019/04/12 10:54:54.
 */
@Service
public class ThisRaceService {

    @Autowired
    private ThisRaceMapper thisRaceMapper;

    public List<ThisRace> getPageList(ThisRace thisRace){
        return thisRaceMapper.getPageList(thisRace);
    }

    public ApiResult addThisRace(ThisRace thisRace) {
        int num = thisRaceMapper.insertSelective(thisRace);
        return  new ApiResult(num);
    }

    public ApiResult getThisRaceById(Long id) {
        ThisRace thisRace = thisRaceMapper.selectByPrimaryKey(id);
        return new ApiResult(true,"获取数据成功！",thisRace);
    }

    public ApiResult editThisRace(ThisRace thisRace) {
        int num = thisRaceMapper.updateByPrimaryKey(thisRace);
        return  new ApiResult(num);
    }

    public ApiResult deleteThisRace(Long id) {
        int num = thisRaceMapper.deleteByPrimaryKey(id);
        return  new ApiResult(num);
    }
}
